'\" te
.\" Copyright (c) 1992, Sun Microsystems, Inc.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SORTBIB 1 "Sep 14, 1992"
.SH NAME
sortbib \- sort a bibliographic database
.SH SYNOPSIS
.LP
.nf
\fBsortbib\fR [\fB-s\fR \fIKEYS\fR] \fIdatabase\fR...
.fi

.SH DESCRIPTION
.sp
.LP
\fBsortbib\fR sorts files of records containing \fBrefer\fR key-letters by
user-specified keys. Records may be separated by blank lines, or by
`\fB\&.[\fR' and `\fB\&.]\fR' delimiters, but the two styles may not be mixed
together. This program reads through each \fIdatabase\fR and pulls out key
fields, which are sorted separately. The sorted key fields contain the file
pointer, byte offset, and length of corresponding records. These records are
delivered using disk seeks and reads, so \fBsortbib\fR may not be used in a
pipeline to read standard input.
.sp
.LP
The most common key-letters and their meanings are given below.
.sp
.ne 2
.na
\fB\fB%A\fR\fR
.ad
.RS 8n
Author's name
.RE

.sp
.ne 2
.na
\fB\fB%B\fR\fR
.ad
.RS 8n
Book containing article referenced
.RE

.sp
.ne 2
.na
\fB\fB%C\fR\fR
.ad
.RS 8n
City (place of publication)
.RE

.sp
.ne 2
.na
\fB\fB%D\fR\fR
.ad
.RS 8n
Date of publication
.RE

.sp
.ne 2
.na
\fB\fB%E\fR\fR
.ad
.RS 8n
Editor of book containing article referenced
.RE

.sp
.ne 2
.na
\fB\fB%F\fR\fR
.ad
.RS 8n
Footnote number or label (supplied by \fBrefer\fR)
.RE

.sp
.ne 2
.na
\fB\fB%G\fR\fR
.ad
.RS 8n
Government order number
.RE

.sp
.ne 2
.na
\fB\fB%H\fR\fR
.ad
.RS 8n
Header commentary, printed before reference
.RE

.sp
.ne 2
.na
\fB\fB%I\fR\fR
.ad
.RS 8n
Issuer (publisher)
.RE

.sp
.ne 2
.na
\fB\fB%J\fR\fR
.ad
.RS 8n
Journal containing article
.RE

.sp
.ne 2
.na
\fB\fB%K\fR\fR
.ad
.RS 8n
Keywords to use in locating reference
.RE

.sp
.ne 2
.na
\fB\fB%L\fR\fR
.ad
.RS 8n
Label field used by \fB-k\fR option of \fBrefer\fR
.RE

.sp
.ne 2
.na
\fB\fB%M\fR\fR
.ad
.RS 8n
Bell Labs Memorandum (undefined)
.RE

.sp
.ne 2
.na
\fB\fB%N\fR\fR
.ad
.RS 8n
Number within volume
.RE

.sp
.ne 2
.na
\fB\fB%O\fR\fR
.ad
.RS 8n
Other commentary, printed at end of reference
.RE

.sp
.ne 2
.na
\fB\fB%P\fR\fR
.ad
.RS 8n
Page number(s)
.RE

.sp
.ne 2
.na
\fB\fB%Q\fR\fR
.ad
.RS 8n
Corporate or Foreign Author (unreversed)
.RE

.sp
.ne 2
.na
\fB\fB%R\fR\fR
.ad
.RS 8n
Report, paper, or thesis (unpublished)
.RE

.sp
.ne 2
.na
\fB\fB%S\fR\fR
.ad
.RS 8n
Series title
.RE

.sp
.ne 2
.na
\fB\fB%T\fR\fR
.ad
.RS 8n
Title of article or book
.RE

.sp
.ne 2
.na
\fB\fB%V\fR\fR
.ad
.RS 8n
Volume number
.RE

.sp
.ne 2
.na
\fB\fB%X\fR\fR
.ad
.RS 8n
Abstract \(em used by \fBroffbib\fR, not by \fBrefer\fR
.RE

.sp
.ne 2
.na
\fB\fB%Y,Z\fR\fR
.ad
.RS 8n
Ignored by \fBrefer\fR
.RE

.sp
.LP
By default, \fBsortbib\fR alphabetizes by the first \fB%A\fR and the \fB%D\fR
fields, which contain the senior author and date.
.sp
.LP
\fBsortbib\fR sorts on the last word on the \fB%A\fR line, which is assumed to
be the author's last name. A word in the final position, such as `\fBjr.\fR' or
`\fBed.\fR', will be ignored if the name beforehand ends with a comma. Authors
with two-word last names or unusual constructions can be sorted correctly by
using the \fBnroff\fR convention `\fB\e0\fR\&' in place of a blank. A \fB%Q\fR
field is considered to be the same as \fB%A\fR, except sorting begins with the
first, not the last, word. \fBsortbib\fR sorts on the last word of the \fB%D\fR
line, usually the year. It also ignores leading articles (like `\fBA\fR' or
`\fBThe\fR') when sorting by titles in the \fB%T\fR or \fB%J\fR fields; it will
ignore articles of any modern European language. If a sort-significant field is
absent from a record, \fBsortbib\fR places that record before other records
containing that field.
.sp
.LP
No more than 16 databases may be sorted together at one time. Records longer
than 4096 characters will be truncated.
.SH OPTIONS
.sp
.ne 2
.na
\fB\fB-s\fR\fIKEYS\fR\fR
.ad
.RS 10n
Specify new \fIKEYS\fR. For instance, \fB-sATD\fR will sort by author, title,
and date, while \fB-sA+D\fR will sort by all authors, and date. Sort keys past
the fourth are not meaningful.
.RE

.SH SEE ALSO
.sp
.LP
.BR addbib (1),
.BR indxbib (1),
.BR lookbib (1),
.BR refer (1),
.BR roffbib (1),
.BR attributes (7)
.SH BUGS
.sp
.LP
Records with missing author fields should probably be sorted by title.
